﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LanguageTraning
{
    class ExtenedMethod
    {
        public void TestMethod()
        {
            Console.WriteLine("---------------------------------------------");
            Console.WriteLine("this is example of {0}", this.GetType().ToString());

            string s = "hello world";
            s.Foo(1);
            
            //===
            StringExtensions.Foo(s, 1);
        }
    }

    public static class StringExtensions
    {
        public static void Foo(this string s, int point)
        {
            Console.WriteLine( "{0} is {1} extended method", s, point);
        }
    }
}

namespace LanguageTraning.ExtendedMethod
{
    public static class StringExtensions
    {
        public static void Foo(this string s, int point)
        {
            Console.WriteLine("{0} is {1} extended method under LanguageTraning.ExtendedMethod", s, point);
        }
    }
}

